package com.mmm;

import com.mmm.filter.AccessFilter;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;

@EnableZuulProxy
@SpringCloudApplication   //整合了@SpringBootApplication、@EnableDiscoveryClient、@EnableCircuit
public class ZuulApplication {
    //服务网关 ，可以用同一个url访问以下2个负载sever
    // http://localhost:5555/ribbon/addtest?accessToken=token
    // http://localhost:5555/feign/addtest?accessToken=token

    public static void main(String[] args) {
        new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);
    }

    @Bean
    public AccessFilter accessFilter() {  //服务过滤,可以制定访问权限
        return new AccessFilter();
    }
}
